L=10000; S=7; T=7; M=100; stones=[1111,1118,1114,1117,3010,7508,1119,1105,899,1112,9667,3238,1108,5178,4627,2116,2089,9184,1115,8887,3565,3560,3559,3562,2410,3564,3571,565,3561,3566,3573,7432,9485,4484,7258,4555,8812,1291,3567,3221,5252,5253,5244,797,5251,7885,5245,9340,5255,6537,7737,5243,9316,5246,6694,6773,5247,6031,5256,5249,5484,5482,7513,5485,5479,5481,5480,5489,381,2572,9255,7624,5821,8606,7829,5488,442,5490,5492,8098,483,482,481,478,469,474,4054,472,471,4407,479,7006,475,470,3147,6933,9097,7781,473,2221];